﻿using System;
using System.Xml.Serialization;

namespace Toybox.NicoSharp.Message
{
	using Utilities;

	/// <summary>
	/// プレミアムタイプ
	/// </summary>
	public enum PremiumType
	{
		[XmlEnum(Name = "0")]
		Normal = 0x00,
		[XmlEnum(Name = "1")]
		Premium,
		[XmlEnum(Name = "2")]
		System,
		[XmlEnum(Name = "3")]
		Owner,

		[XmlEnum(Name = "6")]
		BSP = 0x06,
		[XmlEnum(Name = "7")]
		BSPP = 0x07,

		[XmlEnum(Name = "8")]
		IPhone = 0x08,
		[XmlEnum(Name = "9")]
		IPhoneP = 0x09,

		[XmlEnum(Name = "24")]
		IPTouch = 0x18,
		[XmlEnum(Name = "25")]
		IPTouchP = 0x19,
	}

	/// <summary>
	/// Chatの送信結果
	/// </summary>
	public enum ChatState
	{
		[XmlEnum(Name = "0")]
		Success = 0x00,
		[XmlEnum(Name = "1")]
		Failure,
		[XmlEnum(Name = "2")]
		Error2,
		[XmlEnum(Name = "3")]
		Error3,
		[XmlEnum(Name = "4")]
		PostKeyError,
	}

	public class Chat : EventArgs
	{

		#region [Static]

		public static Chat Deserialize(string xml)
		{
			return Deserializer.XmlDeserializer<Chat>(xml);
		}

		#endregion [Static]


		#region Public Members

		/// <summary>
		/// 匿名
		/// </summary>
		[XmlAttribute]
		public bool anonymity;

		/// <summary>
		/// 日時
		/// </summary>
		[XmlAttribute]
		public int date;

		/// <summary>
		/// コマンド
		/// </summary>
		[XmlAttribute]
		public string mail;

		/// <summary>
		/// No
		/// </summary>
		[XmlAttribute]
		public int no;

		/// <summary>
		/// プレミアム種類
		/// </summary>
		[XmlAttribute]
		public PremiumType premium;

		/// <summary>
		/// スレッド
		/// </summary>
		[XmlAttribute]
		public string thread;

		/// <summary>
		/// ユーザーID
		/// </summary>
		[XmlAttribute]
		public string user_id;

		/// <summary>
		/// コメント位置
		/// </summary>
		[XmlAttribute]
		public int vpos;

		/// <summary>
		/// 自分のコメントか
		/// </summary>
		[XmlAttribute]
		public bool yourpost;

		/// <summary>
		/// 名前
		/// </summary>
		[XmlAttribute]
		public string name;

		/// <summary>
		/// 言語
		/// </summary>
		[XmlAttribute]
		public string locale;

		/// <summary>
		/// スコア
		/// </summary>
		[XmlAttribute]
		public int score;

		/// <summary>
		/// 投稿者コメント
		/// </summary>
		[XmlAttribute]
		public bool fork;

		/// <summary>
		/// コメント本体
		/// </summary>
		[XmlText]
		public string comment;

		#endregion Public Members

	}

}